function logout() {
    // Remove the logged-in user's information from local storage
    localStorage.removeItem("loggedinUser");
  
}

function updateProfileDB(name, school, city) {
    var who = JSON.parse(localStorage.getItem("loggedinUser"));
    if (who) {

        var users = JSON.parse(localStorage.getItem("users"));
        var email = who["email"];  //email of who is logged in
        console.log(email);        //debug

        if (users) {
            //find the person who is logged in, from the users collection
            const person = users.find(u => u.email === email);
            if (person) {

	              // Bonus Challenge!
                
                alert('Profile data saved successfully!');
            }
        }
    } else {
        console.log("No one is logged in");
    }
}

